<?php

/**
 * Tarea form base class.
 *
 * @method Tarea getObject() Returns the current form's model object
 *
 * @package    universidad
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseTareaForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'nombre'             => new sfWidgetFormInputText(),
      'encargado_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Miembro'), 'add_empty' => false)),
      'creador_id'         => new sfWidgetFormInputText(),
      'estado'             => new sfWidgetFormChoice(array('choices' => array('pendiente' => 'pendiente', 'aceptada' => 'aceptada', 'rechazada' => 'rechazada', 'cancelada' => 'cancelada', 'terminada' => 'terminada'))),
      'fecha_maxima'       => new sfWidgetFormDateTime(),
      'pre_observaciones'  => new sfWidgetFormTextarea(),
      'post_observaciones' => new sfWidgetFormTextarea(),
      'tarea_id'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Tarea'), 'add_empty' => true)),
      'created_at'         => new sfWidgetFormDateTime(),
      'updated_at'         => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'nombre'             => new sfValidatorString(array('max_length' => 255)),
      'encargado_id'       => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Miembro'))),
      'creador_id'         => new sfValidatorInteger(),
      'estado'             => new sfValidatorChoice(array('choices' => array(0 => 'pendiente', 1 => 'aceptada', 2 => 'rechazada', 3 => 'cancelada', 4 => 'terminada'), 'required' => false)),
      'fecha_maxima'       => new sfValidatorDateTime(),
      'pre_observaciones'  => new sfValidatorString(array('required' => false)),
      'post_observaciones' => new sfValidatorString(array('required' => false)),
      'tarea_id'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Tarea'), 'required' => false)),
      'created_at'         => new sfValidatorDateTime(),
      'updated_at'         => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('tarea[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Tarea';
  }

}
